<template>
  <view class="t-info">
    <view class="t-b">设置头像</view>
    <div class="head-layout">
      <div class="item-layout" @tap="selectType='manNo'">
        <div :class="(selectType==='manNo'?'':'no-')+'select-item-bg'">
          <u--image bgColor="#f05f5d" :src='manUrl' shape="circle" width="80" height="80"/>
        </div>
        <view style="margin-top: 10px;">男</view>
      </div>
      <div class="item-layout" @tap="selectType='womanNo'">
        <div :class="(selectType==='womanNo'?'':'no-')+'select-item-bg'">
          <u--image bgColor="#f05f5d" :src='womanUrl' shape="circle" width="80" height="80"/>
        </div>
        <view style="margin-top: 10px;">女</view>
      </div>
    </div>
    <form class="cl">
      <text class="t-c"> 请选择一款默认头像</text>
      <button @tap="uploadLogo()">完成</button>

    </form>
  </view>
</template>

<script>
import userApi from '@/api/user'
import passData from '@/api/requstUtil'

export default {
  data() {
    return {
      manUrl: 'http://8.134.137.109:9001/agent/images/bVOfe2sbJNxZuHoQO2OulPsyTgF6bpBG.png',
      manNo: '202406180957198089560199782',
      womanUrl: 'http://8.134.137.109:9001/agent/images/FuFyNo5kpr8VVyQjTqlNatQ05uhe3wMw.png',
      womanNo: '202406180958326894438285687',
      selectType: '',
      fileList6: [],

    }
  },
  methods: {
    uploadLogo() {
      if (!this.selectType) {
        uni.showToast({title: '请选择头像', icon: 'none'});
        return false;
      }
      userApi.uploadImage({imgBsnNo: this[this.selectType]}).then(res => {
        let data = passData(res);
        if (data) {
          uni.navigateTo({url: '/pages/index/index'});
        }
      });
    },


    afterRead() {

    },
    deletePic() {

    },

  }
}
</script>

<style lang="scss" scoped>

.head-layout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-evenly;

  .item-layout {
    display: flex;
    flex-direction: column;
    align-items: center;

    .select-item-bg {
      border: solid #f05f5d 2px;
      border-radius: 50%;
    }

    .no-select-item-bg {
      border: solid grey 2px;
      border-radius: 50%;
    }
  }
}

.t-b {
  font-size: 18px;
  color: #000;
  padding: 35px 0 30px 0;
  font-weight: bold;
  text-align: center;
}

.t-u uni-view {

  justify-content: center;
}


.t-info {
  width: 600rpx;
  margin: 0 auto;
  font-size: 28rpx;
  color: #000;
}


.t-info button {
  font-size: 14px;
  background: rgb(240, 95, 93);
  color: #fff;
  height: 42px;
  line-height: 45px;
  border-radius: 9px;
  box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  width: 55%;
  margin-top: 28px;
}


.t-info input {
  padding: 0 10px 0 21px;
  height: 46px;
  line-height: 46px;
  margin-bottom: 26px;
  background: #f8f7fc;
  border-bottom: 1px solid #e9e9e9;
  font-size: 15px;
  border-radius: 5px;
}

.t-c {
  color: #ccc;
  width: 100%;
  text-align: center;
  display: inline-block;
}

.t-d {
  width: 100px;
  height: 100px;
}

</style>
